package com.wlhse.controller;

import com.wlhse.dto.getDto.BaseGetDto;
import com.wlhse.entity.LeaderCheckItemPojo;
import com.wlhse.service.LeaderCheckItemService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController("LeaderCheckItemController")
@RequestMapping("/api/v1")
public class LeaderCheckItemController {

    @Resource
    private LeaderCheckItemService leaderCheckItemService;

    @RequestMapping(value = "/leader/check_item/tree", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryTree() {
        return leaderCheckItemService.queryTree();
    }

    @RequestMapping(value = "/leader/check_item/tree", method = RequestMethod.PUT, produces = "application/json; charset=utf-8")
    public String update(@RequestBody LeaderCheckItemPojo leaderCheckItemPojo) {
        return leaderCheckItemService.update(leaderCheckItemPojo.getCheckItemCode());
    }

    @RequestMapping(value = "/leader/check_item/tree", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String add(@RequestBody LeaderCheckItemPojo leaderCheckItemPojo) {
        return leaderCheckItemService.add(leaderCheckItemPojo);
    }
}
